package com.athuahua.mq;

import jakarta.annotation.Resource;
import org.junit.jupiter.api.Test;
import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.boot.test.context.SpringBootTest;

/**
 * @Author: huahua
 * @Date: 2024/9/6 0006
 * @Time: 15:04
 * @Description:
 */
@SpringBootTest
public class RabbitMqText {
    public static final String EXCHANGE_NAME = "exchange.tx.dragon";
    public static final String ROUTING_KEY = "routing.key.tx.dragon";

    @Resource
    private RabbitTemplate rabbitTemplate;

    @Test
    public void test01() {
        rabbitTemplate.convertAndSend(
                EXCHANGE_NAME, ROUTING_KEY,
                "i am a tx one"
        );

        System.out.println(10 / 0);

        rabbitTemplate.convertAndSend(
                EXCHANGE_NAME, ROUTING_KEY,
                "i am a tx two"
        );
    }
}
